#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
typedef long long LL;
#define x first
#define y second
//typedef pair<pair<int, int>, pair<int, int>> PII;
const int N = 2e5 + 10;
LL a[N];
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		LL x1 = 0, x2 = 0;
		bool flag = 0;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			if (a[i] > 0)flag = 1;
		}
		if (n == 1) {
			cout << a[1] << endl;
			continue;
		}
		if (flag) {
			for (int i = 1; i <= n; i++) {
				if (i & 1 && a[i] > 0)x1 += a[i];
				if ((i & 1) == 0 && a[i] > 0)x2 += a[i];
			}
		}
		else {
			x1 = -1e15, x2 = -1e15;
			for (int i = 1; i <= n; i++) {
				if (i & 1)x1 = max(x1, a[i]);
				if ((i & 1) == 0)x2 = max(x2, a[i]);
			}
		}
		cout << max(x1, x2) << endl;
	}
	return 0;
}